const fs = require('fs');
let mobile = "1133123456789"
// resolve
let p = new Promise((resolve, reject) => {
  fs.readFile("./chp07-01promise.txt","utf-8",(err,data) => {
    if (err) {
      reject("出错了")
      return
    }
    let arr = data.split("\r\n")
    let ren_arr =  arr[0].split(":")
    if (ren_arr[0]===mobile) {    
      let name = ren_arr[1];
      resolve(name)
    }
  })
})

p.then((name) => {
  console.log("我是then");
  console.log(name);
}).catch((err) => {
  console.log(err);
})


